home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-05 | 4.5 KB | 197 lines | [TEXT/MMCC] |
- // CReminderEntry.cp - manage Reminder entries
- // Created 10/5/95 8:02 PM by AppMaker
-
- #include "CReminderEntry.h"
-
- #include "NeoTypes.h"
- #include CNeoDatabaseH
- #include CNeoMetaClassH
- #include CNeoStreamH
-
- #include <String_Utils.h>
-
- //----------
- CReminderEntry::CReminderEntry ()
- {
- mDateField [0] = 0;
- mTimeField [0] = 0;
- mMessageField [0] = 0;
- mAmPmChoice = 0;
- mShowAlertCheck = false;
- mPlaySoundCheck = false;
- mShowIconCheck = false;
- mSoundIndex = 0;
- }
-
- //----------
- CReminderEntry::CReminderEntry (CNeoDatabase *inFile)
- {
- fID = inFile->getUniqueID();
- // ? redundant because CNeoPersist will do it automatically ?
-
- mDateField [0] = 0;
- mTimeField [0] = 0;
- mMessageField [0] = 0;
- mAmPmChoice = 0;
- mShowAlertCheck = false;
- mPlaySoundCheck = false;
- mShowIconCheck = false;
- mSoundIndex = 0;
- }
-
- //----------
- CReminderEntry::~CReminderEntry ()
- {
- }
-
- //----------
- // functions to access the data members
-
- void CReminderEntry::GetDateField (StringPtr text) const
- {
- CopyPStr (mDateField, text);
- }
-
- void CReminderEntry::SetDateField (ConstStr255Param text)
- {
- CopyPStr (text, mDateField);
- }
-
- void CReminderEntry::GetTimeField (StringPtr text) const
- {
- CopyPStr (mTimeField, text);
- }
-
- void CReminderEntry::SetTimeField (ConstStr255Param text)
- {
- CopyPStr (text, mTimeField);
- }
-
- void CReminderEntry::GetMessageField (StringPtr text) const
- {
- CopyPStr (mMessageField, text);
- }
-
- void CReminderEntry::SetMessageField (ConstStr255Param text)
- {
- CopyPStr (text, mMessageField);
- }
-
- void CReminderEntry::SetAmPmChoice (long state)
- {
- mAmPmChoice = state;
- }
-
- void CReminderEntry::SetShowAlertCheck (Boolean state)
- {
- mShowAlertCheck = state;
- }
-
- void CReminderEntry::SetPlaySoundCheck (Boolean state)
- {
- mPlaySoundCheck = state;
- }
-
- void CReminderEntry::SetShowIconCheck (Boolean state)
- {
- mShowIconCheck = state;
- }
-
- void CReminderEntry::SetSoundIndex (short state)
- {
- mSoundIndex = state;
- }
-
- //----------
- CNeoMetaClass* CReminderEntry::GetMetaClass (void)
- {
- return CNeoMetaClass::GetMetaClass (kReminderEntryID);
- }
-
- //----------
- void CReminderEntry::AddMetaClass (void)
- {
- CNeoMetaClass *meta;
-
- meta = CReminderEntry::GetMetaClass ();
- if (meta == nil) {
- new CNeoMetaClass (kReminderEntryID, kNeoPersistID,
- "\pCReminderEntry", CReminderEntry::New);
- }
- }
-
- //----------
- CNeoPersist* CReminderEntry::New (void)
- {
- return new CReminderEntry;
- }
-
- //----------
- #pragma segment NeoSearch
- CReminderEntry* CReminderEntry::FindByID (CNeoDatabase *aFile,
- const NeoID aID,
- const Boolean aDeeply,
- NeoTestFunc1 aFunc,
- void* aParam,
- const NeoLockType aLock)
- {
- return (CReminderEntry *)CNeoPersist::FindByID (aFile, kReminderEntryID,
- aID, aDeeply,
- aFunc, aParam, aLock);
- }
-
- //----------
- // This method returns the amount of file space the object occupies in the file.
- // It differs from the getLength() in that getLength returns the size of the
- // object in memory.
- #pragma segment NeoInfo
- long CReminderEntry::getFileLength (void) const
- {
- const long kReminderEntryDataLength =
- (sizeof(mDateField)
- + sizeof(mTimeField)
- + sizeof(mMessageField)
- + sizeof(mAmPmChoice)
- + sizeof(mShowAlertCheck)
- + sizeof(mPlaySoundCheck)
- + sizeof(mShowIconCheck)
- + sizeof(mSoundIndex));
- const long kReminderEntryFileLength = (kNeoPersistFileLength + kReminderEntryDataLength);
-
- return kReminderEntryFileLength;
- }
-
- //----------
- #pragma segment NeoRead
- void CReminderEntry::readObject (CNeoStream *aStream,
- const NeoTag aTag)
- {
- inherited::readObject(aStream, aTag);
-
- aStream->readString (mDateField, sizeof(mDateField), aTag);
- aStream->readString (mTimeField, sizeof(mTimeField), aTag);
- aStream->readString (mMessageField, sizeof(mMessageField), aTag);
- mAmPmChoice = aStream->readLong (aTag);
- mShowAlertCheck = aStream->readBoolean (aTag);
- mPlaySoundCheck = aStream->readBoolean (aTag);
- mShowIconCheck = aStream->readBoolean (aTag);
- mSoundIndex = aStream->readShort (aTag);
- }
-
- //----------
- #pragma segment NeoWrite
- void CReminderEntry::writeObject (CNeoStream *aStream,
- const NeoTag aTag)
- {
- inherited::writeObject(aStream, aTag);
-
- aStream->writeString (mDateField, sizeof(mDateField), aTag);
- aStream->writeString (mTimeField, sizeof(mTimeField), aTag);
- aStream->writeString (mMessageField, sizeof(mMessageField), aTag);
- aStream->writeLong (mAmPmChoice, aTag);
- aStream->writeBoolean (mShowAlertCheck, aTag);
- aStream->writeBoolean (mPlaySoundCheck, aTag);
- aStream->writeBoolean (mShowIconCheck, aTag);
- aStream->writeShort (mSoundIndex, aTag);
- }
-